#!/bin/bash

CONFIG_FILE="$HOME/.config/qutebrowser/config.py"
PROXY_SETTING="config.set('content.proxy', 'http://192.168.50.10:1082/')"

# 检查当前是否已经设置了代理
if grep -q "^$PROXY_SETTING" "$CONFIG_FILE"; then
  # 如果已经设置了代理，则注释掉
  sed -i "s|^$PROXY_SETTING|# $PROXY_SETTING|" "$CONFIG_FILE"
  echo "Proxy disabled"
else
  # 如果没有设置代理，则取消注释
  sed -i "s|^# $PROXY_SETTING|$PROXY_SETTING|" "$CONFIG_FILE"
  echo "Proxy enabled"
fi
